import random,time

aa = random.randint(10,100)
aa_list = []
for i in range(1,10000):
    aa = random.randint(10, 100)
    aa_list.append(aa)

print(aa_list)

# 插入排序
def insertion_sort(arr):
    # 第一层for表示循环插入的遍数
    for i in range(len(arr)):
        # 当前需要插入的元素
        current = arr[i]
        # 与当前元素比较的比较元素
        pre_index = i -1
        while pre_index >= 0 and arr[pre_index] > current:
            # 当比较元素大于当前元素则把比较元素后移
            arr[pre_index + 1] = arr[pre_index]
            # 往前选择下一个比较元素
            pre_index -= 1
        # 当比较元素大于当前元素则把比较元素后裔
        arr[pre_index + 1] = current
    return arr


B = insertion_sort(aa_list)
start = time.perf_counter()
print(aa_list)
print("耗时>>>",start)